const express = require('express')
const pool = require('../pool.js')
// 创建路由器对象
const router = express.Router()
const md5 = require('md5')
const { application } = require('express')
module.exports = router

//获取人气蛋糕接口
router.get('/hot_cake',(req,res)=>{
  let sql = 'select * from cake where category=1'
  pool.query(sql,(err,results)=>{
    if(err) throw err
    res.send({message:'ok',code:200,results:results})
  })
})

//获取生日蛋糕接口
router.get('/birth_cake',(req,res)=>{
  let sql = 'select * from cake where category=2'
  pool.query(sql,(err,results)=>{
    if(err) throw err
    res.send({message:'ok',code:200,results:results})
  })
})

//获取面包甜点接口
router.get('/bread_cake',(req,res)=>{
  let sql = 'select * from cake where category=3'
  pool.query(sql,(err,results)=>{
    if(err) throw err
    res.send({message:'ok',code:200,results:results})
  })
})

